from django.db import models

# Create your models here.

class SiteName(models.Model):
    
    name = models.CharField(max_length=50)
    url = models.URLField(max_length=50)
    #instrument = models.CharField(max_length=100)

    #def __new__

    def __str__(self):

        return self.name


class FilmType(models.Model):

    film_type = models.CharField(max_length=50)

    def __str__(self):

        return self.film_type

class Director(models.Model):

    name = models.CharField(max_length=50)

    def __str__(self):

        return self.name


class Actor(models.Model):

    name = models.CharField(max_length=50)

    def __str__(self):

        return self.name


class State(models.Model):#拍摄国家

    name = models.CharField(max_length=50)

    def __str__(self):

        return self.name


class Language(models.Model):

    name = models.CharField(max_length=50)

    def __str__(self):

        return self.name

class ReleaseState(models.Model):#上映国家
    

    name = models.CharField(max_length=50)

    def __str__(self):

        return self.name

    

    

class Film(models.Model):

    name = models.CharField(max_length=50)
    
    director = models.ManyToManyField(Director)

    actor = models.ManyToManyField(Actor)

    state = models.ManyToManyField(State)

    release_state = models.ManyToManyField(ReleaseState, through = 'ReleaseTime')

    site_name = models.ManyToManyField(SiteName)

    film_type = models.ManyToManyField(FilmType)

    intro = models.TextField()

    #release_date = 

class ReleaseTime(models.Model):

    film = models.ForeignKey(Film, on_delete=models.CASCADE)

    release_state = models.ForeignKey(ReleaseState, on_delete=models.CASCADE)

    release_time = models.DateTimeField()




    
    

    

    

    

    

    




































    

    
